package com.ruoyi.framework.web.domain;

import lombok.Data;


/**
 * 返回实体类对象
 */
@Data
public class ResultToken {
    private int code;

    private String messageString;

    private String token;

    private Object data;

    public static ResultToken success(Object object){
        ResultToken success=new ResultToken();
        success.code=200;
        success.data= object;
        return success;
    }

    public static ResultToken successToken(Object object,String token){
        ResultToken success=new ResultToken();
        success.code=200;
        success.token = token;
        success.data= object;
        return success;
    }

    public static ResultToken warn(String messageString,Object object){
        ResultToken success=new ResultToken();
        success.code=201;
        success.data= object;
        success.messageString= messageString;
        return success;
    }

    public static ResultToken error(String str){
        ResultToken error=new ResultToken();
        error.code=0;
        error.messageString=str;
        return error;
    }
    public static ResultToken error(String str,int code){
        ResultToken error=new ResultToken();
        error.code=code;
        error.messageString=str;
        return error;
    }


}

